home *** CD-ROM | disk | FTP | other *** search
/ PC Gamer (Italian) 30 / PC Gamer IT CD 30 1-2.iso / MOTS / GAMEDATA / RESOURCE / JKMRES.GOO / cog_pow_railgun_m.cog < prev    next >
Text File  |  1998-02-25  |  3KB  |  127 lines

  1. # Jedi Knight Missions Cog Script
  2. #
  3. # POW_RAILGUN_M.COG
  4. #
  5. # POWERUP Script - Rail Detonator
  6. #
  7. # [YB & CYW] + [RF]
  8. #
  9. # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
  10.  
  11.  
  12. symbols
  13.  
  14. thing       powerup                          local
  15. thing       player                           local
  16. int         bin=127                          local
  17.  
  18. # Bin for the Seeker.
  19. int         sbin=137                         local
  20.  
  21. # Weapon order bin.
  22. int         wobin=7                          local
  23.  
  24. int         ammobin=15                       local
  25. sound       pickupsnd=powerpu1.wav           local
  26. sound       respawnsnd=Activate01.wav        local
  27. flex        amount                           local
  28.  
  29. int         bin_contents=0                   local
  30. int         autopickup=0                     local
  31. int         autosel=-1                       local
  32.  
  33. message     touched
  34. message     taken
  35. message     respawn
  36.  
  37. end
  38.  
  39. # ========================================================================================
  40.  
  41. code
  42.  
  43. touched:
  44.    player = GetSourceRef();
  45.  
  46.    if (GetThingType(player) == 10)  // Can only be taken by players.
  47.    {
  48.       if(IsMulti() || (GetInv(player, bin) == 0) || (GetInv(player, ammobin) < GetInvMax(player, ammobin)))
  49.       {
  50.          TakeItem(GetSenderRef(), -1);
  51.          call taken;
  52.       }
  53.    }
  54.  
  55.    Return;
  56.  
  57. # ........................................................................................
  58.  
  59. taken:
  60.    player = GetSourceRef();
  61.    powerup = GetSenderRef();
  62.  
  63.    // Do effects.
  64.    PlaySoundLocal(pickupsnd, 1, 0, 0);
  65.    AddDynamicTint(player, 0.0, 0.0, 0.2);
  66.  
  67.    if(GetInv(player, bin) == 0)
  68.    {
  69.       // Pickup gun and ammo.
  70.       // Print("Rail Detonator");
  71.       jkPrintUNIString(player, bin);
  72.  
  73.       ChangeInv(player, bin, 1.0);
  74.       ChangeInv(player, sbin, 1.0);
  75.       ChangeInv(player, ammobin, 6.0);
  76.  
  77.       // Check for Auto Pickup
  78.       autopickup = GetAutoPickup();
  79.       if((autopickup & 1) && !(autopickup & 2)) // DANGEROUS
  80.       {
  81.          if(!((autopickup & 4) && (GetWeaponPriority(player, GetWeaponBin(GetCurWeapon(player)), 0) >= GetWeaponPriority(player, bin, 0))))
  82.          {
  83.             if(!((autopickup & 8) && (GetWeaponBin(GetCurWeapon(player)) == jkGetMultiParam(1))))
  84.             {
  85.                SelectWeapon(player, bin);
  86.                Return;
  87.             }
  88.          }
  89.       }
  90.    }
  91.    else
  92.    if(GetInv(player, ammobin) < GetInvMax(player, ammobin))
  93.    {
  94.       // Pickup ammo only.
  95.       // Print("Rail Charges");
  96.       jkPrintUNIString(player, ammobin);
  97.  
  98.       // store the old bin contents
  99.       bin_contents = GetInv(player, ammobin);
  100.  
  101.       ChangeInv(player, ammobin, 6.0);
  102.  
  103.       // Check for Auto Reload
  104.       if(GetAutoReload() & 1)
  105.       {
  106.          if(!bin_contents)
  107.          {
  108.             if(!((GetAutoReload() & 2) && (GetWeaponBin(GetCurWeapon(player)) == jkGetMultiParam(1))))
  109.             {
  110.                // Try to autoselect and see if the best weapon is the railgun
  111.                if(AutoSelectWeapon(player, 2) == wobin) SelectWeapon(player, wobin);
  112.             }
  113.          }
  114.       }
  115.    }
  116.  
  117.    Return;
  118.  
  119. # ........................................................................................
  120.  
  121. respawn:
  122.    PlaySoundThingLocal(respawnsnd, GetSenderRef(), 0.6, 5.0, 10.0, 0);
  123.  
  124.    Return;
  125.  
  126. end
  127.